package cn.taobaoke.restful.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 管理员信息表。
 *
 * @author yangzuo
 * @since 2017-03-11
 */
@Setter
@Getter
@ToString
@Table(name = "tb_admin")
@Entity
@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AdminEntity1 implements Serializable {

    public AdminEntity1() {}

    public AdminEntity1(AdminEntity entity, Long domainId) {
        this.id = entity.getId();
        this.weChat = entity.getWeChat();
        this.name = entity.getName();
        this.phone = entity.getPhone();
        this.password = entity.getPassword();
        this.token = entity.getToken();
        this.createTime = entity.getCreateTime();
        this.modifiedTime = entity.getModifiedTime();
        this.isDelete = entity.getIsDelete();
        this.domainId = domainId;
    }

    @Id
    @GeneratedValue
    private Long id;

    @Column
    private String weChat;

    @Column
    private String name;

    @Column
    private String phone;

    @Column(nullable = false)
    private String password;

    @Column
    private String token;

    @Column
    private Date createTime;

    @Column
    private Date modifiedTime;

    @Column
    private Boolean isDelete;

    @Column
    private Long domainId;
}
